<include file="public@header"/>
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li ><a href="{:url('meeting/hire/lists')}">租赁服务管理</a></li>
        <li><a href="{:url('meeting/hire/add')}">添加租赁服务</a></li>
        <li class="active"><a href="{:url('meeting/hire/classList')}">服务分类</a></li>
        <li ><a href="javascript:void(0);" onclick="check('','','')">添加服务分类</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="post" action="{:url('meeting/hire/classList')}">
        分类名称：
        <input class="form-control" type="text" name="class_name" style="width: 200px;" value="{:input('request.class_name')}"
               placeholder="">
        <input type="submit" class="btn btn-primary" value="搜索"/>
        <a class="btn btn-danger" href="{:url('meeting/hire/classList')}">清空</a>
    </form>
    <form method="post" class="js-ajax-form">
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
                <th>id</th>
                <th>分类名</th>
                <th>描述</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <foreach name="list" item="vo">
                <tr>
                    <td>{$vo.class_id}</td>
                    <td>{$vo.class_name}</td>
                    <td>{$vo.description}</td>
                    <td>
                        <a href="javascript:void(0);" onclick="check({$vo['class_id']},'{$vo['class_name']}','{$vo['description']}')" class="btn btn-success">编辑</a>
                        <a href="{:url('class_dele',['class_id'=>$vo['class_id']])}" class="btn btn-danger js-ajax-dialog-btn">删除</a>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
    </form>
    <div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                    <h5 class="modal-title" id="myModalLabel" style="font-size: 16px;">审核</h5>
                </div>
                <form action="{:url('class_add')}"  method="post" class="form js-ajax-form" >
                    <div class="modal-body">

                        <div class="form-group">
                            <label for="two">分类名</label>
                            <input  class="form-control" type="text" name="class_name"  id="class_name" value=""  placeholder="分类名">
                        </div>

                        <div class="form-group">
                            <input  class="form-control" type="text" name="description" id="description"  value=""  placeholder="描述">
                        </div>
                    </div>
                    <div class="modal-footer">
                        <input type="hidden" id="class_id" name="class_id" value=""/>
                        <button type="submit" id="submit" class="btn btn-success js-ajax-submit">提交</button>
                    </div>
                </form>

            </div>
        </div>
    </div>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
    function check(id,name,desc) {
        $('#myModal2').modal('show')

        if(id){
            $('#class_id').val(id)
            $('#class_name').val(name)
            $('#description').val(desc)
        }else{
            $('#class_id').val('')
            $('#class_name').val('')
            $('#description').val('')
        }

    }
</script>
</body>
</html>